package com.jeewms.www.tms.ui.view;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;

import com.lxj.xpopup.core.CenterPopupView;
import com.jeewms.www.tms.R;
import com.jeewms.www.tms.util.QRcodeUtil;
import com.zhy.android.percent.support.PercentRelativeLayout;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class QRPopupView extends CenterPopupView {

    @BindView(R.id.img_qr)
    ImageView imgQr;
    @BindView(R.id.ll_holder)
    PercentRelativeLayout llHolder;
    String str;

    public QRPopupView(@NonNull Context context) {
        super(context);
    }
    public QRPopupView(@NonNull Context context, String str) {
        super(context);
        this.str=str;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        ButterKnife.bind(this);
        initView();
        QRcodeUtil.setCode(str, imgQr);
    }

    private void initView() {

    }

    @Override
    protected void onShow() {
        super.onShow();
        ButterKnife.bind(this);
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.popup_qr;
    }

    @OnClick({R.id.img_qr, R.id.ll_holder})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.img_qr:
                dismiss();
                break;
            case R.id.ll_holder:
                dismiss();
                break;
        }
    }
}
